import { request } from '@/utils/request.js';

const url = '/adminapi/database/';

/**
 * 备份列表
 */
export function apiExportList(params) {
  return request({
    url: `${url}exportList`,
    method: 'get',
    params: params,
  });
}

/**
 * 备份
 */
export function apiExport(data) {
  return request({
    url: `${url}doExport`,
    method: 'post',
    data: data,
  });
}

/**
 * 优化表
 */
export function apiOptimize(data) {
  return request({
    url: `${url}optimize`,
    method: 'post',
    data: data,
  });
}

/**
 * 修复表
 */
export function apiRepair(data) {
  return request({
    url: `${url}repair`,
    method: 'post',
    data: data,
  });
}

/**
 * 还原列表
 */
export function apiImportList(params) {
  return request({
    url: `${url}importList`,
    method: 'get',
    params: params,
  });
}

/**
 * 还原
 */
export function apiImport(data) {
  return request({
    url: `${url}doImport`,
    method: 'post',
    data: data,
  });
}

/**
 * 删除备份文件
 */
export function apiDel(params) {
  return request({
    url: `${url}delete`,
    method: 'get',
    params: params,
  });
}

/**
 * 查看表结构
 */
export function apiView(params) {
  return request({
    url: `${url}view`,
    method: 'get',
    params: params,
  });
}
